/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.bioingenium.kbmed.knowledge.hierarchy.vo;

/**
 *
 * @author Alejandro Riveros Cruz
 */
public class Edge {

    private Vertex source;
    private Vertex target;
    private int weigth;

    /**
     *
     */
    public Edge() {
    }

    /**
     *
     * @param source
     * @param target
     */
    public Edge(Vertex source, Vertex target) {
        this(source, target, 1);
    }

    /**
     *
     * @param source
     * @param target
     * @param weigth
     */
    public Edge(Vertex source, Vertex target, int weigth) {
        this.source = source;
        this.target = target;
        this.weigth = weigth;
    }

    /**
     *
     * @return
     */
    public int getWeigth() {
        return weigth;
    }

    /**
     *
     * @param weigth
     */
    public void setWeigth(int weigth) {
        this.weigth = weigth;
    }

    /**
     *
     * @return
     */
    public Vertex getSource() {
        return source;
    }

    /**
     *
     * @param source
     */
    public void setSource(Vertex source) {
        this.source = source;
    }

    /**
     *
     * @return
     */
    public Vertex getTarget() {
        return target;
    }

    /**
     *
     * @param target
     */
    public void setTarget(Vertex target) {
        this.target = target;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Edge other = (Edge) obj;
        if (this.source != other.source && (this.source == null || !this.source.equals(other.source))) {
            return false;
        }
        if (this.target != other.target && (this.target == null || !this.target.equals(other.target))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 53 * hash + (this.source != null ? this.source.hashCode() : 0);
        hash = 53 * hash + (this.target != null ? this.target.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Edge{" + "source=" + source.getConceptId() + "target=" + target.getConceptId() + "weigth=" + weigth + '}';
    }
}
